test(amber): DB-backed unit tests for ExecutionsMetadataPersistService and updateWorkflowState#5213
Merged
kunwp1 merged 1 commit intoMay 26, 2026
Conversation
…e and updateWorkflowState Adds a MockTexeraDB-backed spec that exercises insertNewExecution, tryGetExistingExecution, tryUpdateExistingExecution, and the ExecutionStateStore.updateWorkflowState wrapper. Two latent silent- failure patterns are pinned with explanatory comments (filed as follow-up bugs): tryGetExistingExecution returns Some(null) for missing eids instead of None, and insertNewExecution propagates a NOT NULL violation when called with uid=None despite the Option[Integer] signature. The pinned None case is paired with an intercept-based xfail-strict test that flips red the day the bug is fixed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5213 +/- ##
============================================
+ Coverage 48.05% 48.42% +0.36%
+ Complexity 2348 2345 -3
============================================
Files 1042 1042
Lines 39973 39973
Branches 4251 4251
============================================
+ Hits 19211 19355 +144
+ Misses 19624 19473 -151
- Partials 1138 1145 +7
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1 task
Ma77Ball
added a commit
to Ma77Ball/texera
that referenced
this pull request
May 26, 2026
### What changes were proposed in this PR? - Change `tryGetExistingExecution` in `ExecutionsMetadataPersistService` to wrap the DAO call with `Option(...)` instead of `Some(...)`, so a missing row (jOOQ returns `null`) collapses to `None` rather than `Some(null)`. - Keep the existing `catch Throwable` block, which still earns its keep for hard DB errors (e.g. closed connection); the `Option` wrap only addresses the no-row miss path. - Update `ExecutionsMetadataPersistServiceSpec` (added in apache#5213): replace the two paired pin tests (the `Some(null)` pin and the inverted `intercept[TestFailedException]` xfail-strict) with a single positive `shouldBe None` test. ### Any related issues, documentation, or discussions? Closes: apache#5211. Depends on apache#5213 (test scaffolding); rebase after it lands. ### How was this PR tested? - Ran `sbt scalafmtAll` (no rewrites needed). - `ExecutionsMetadataPersistServiceSpec.tryGetExistingExecution` now has positive tests for both the hit (`Some(row)`) and the miss (`None`) cases. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.7 in compliance with ASF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Adds
ExecutionsMetadataPersistServiceSpec, aMockTexeraDB-backed unit spec covering the three methods onExecutionsMetadataPersistServiceplus theExecutionStateStore.updateWorkflowStatewrapper that sits on top oftryUpdateExistingExecution. The MockTexeraDB trait (already used byWorkflowExecutionsResourceSpecand peers) spins up an EmbeddedPostgres inbeforeAll, loadssql/texera_ddl.sql, and tears down inafterAll.Two latent silent-failure patterns are pinned with explanatory comments and filed as follow-up bugs:
tryGetExistingExecutionreturnsSome(null)instead ofNonefor unknown eids, andinsertNewExecutionpropagates a NOT NULL violation whenuid=Nonedespite theOption[Integer]signature. The pinnedSome(null)test is paired with anintercept[TestFailedException]-based xfail-strict test asserting the intendedNonecontract — it flips red the day the bug is fixed.Any related issues, documentation, discussions?
Closes #5210. Surfaces #5211 and #5212.
How was this PR tested?
Added unit tests under
amber/src/test/scala/org/apache/texera/web/service/.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7